type DeepReadonly<T> = {
  readonly [P in keyof T]: T[P] extends Function
    ? T[P]
    : T[P] extends object
    ? DeepReadonly<T[P]>
    : T[P];
};

type X = {
  a: () => 22;
  b: string;
  c: {
    d: boolean;
    e: {
      g: {
        h: {
          i: true;
          j: "string";
        };
        k: "hello";
      };
      l: [
        "hi",
        {
          m: ["hey"];
        }
      ];
    };
  };
};

type Dr = DeepReadonly<X>;

type Test<T> = T extends Function ? true : false;
type Test2<T> = T extends object ? true : false;

type Func1 = Test<() => void>;
type Func2 = Test2<() => void>;
type Func21 = Test2<{
  a: () => 22;
}>;
type Func22 = Test<{
  a: () => 22;
}>;
